home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / utils / dumpppu.pp next >
Text File  |  2000-01-01  |  28KB  |  802 lines

  1. {****************************************************************************
  2.  
  3.     $Id: dumpppu.pp,v 1.7 1998/08/12 12:17:07 carl Exp $
  4.  
  5.     Dumps the contents of a FPC unit file (PPU File)
  6.     Copyright (c) 1995,97 by Florian Klaempfl and Michael Van Canneyt
  7.  
  8.     Members of the FPC Development Team
  9.  
  10.     This program is free software; you can redistribute it and/or modify
  11.     it under the terms of the GNU General Public License as published by
  12.     the Free Software Foundation; either version 2 of the License, or
  13.     (at your option) any later version.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU General Public License
  21.     along with this program; if not, write to the Free Software
  22.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24.  ****************************************************************************}
  25.  
  26. {
  27.   possible compiler switches (* marks a currently required switch):
  28.   -----------------------------------------------------------------
  29.   BIG_ENDIAN    Target machine on which this machine will run is
  30.                 a BIG endian machine (such as the m68k)
  31. }
  32.  
  33. {$ifdef TP}
  34. {$N+,E+,G+}
  35. {$endif}
  36.  
  37. program dumpppu;
  38.  
  39.   var
  40.      f : file;
  41.      version : longint;
  42.      Filename : string;
  43.      nrfile : longint;
  44.      flags : byte;
  45.  
  46.     const
  47.        ibloadunit = 1;
  48.        iborddef = 2;
  49.        ibpointerdef = 3;
  50.        ibtypesym = 4;
  51.        ibarraydef = 5;
  52.        ibprocdef = 6;
  53.        ibprocsym = 7;
  54.        iblinkofile = 8;
  55.        ibstringdef = 9;
  56.        ibvarsym = 10;
  57.        ibconstsym = 11;
  58.        ibinitunit = 12;
  59.        ibaufzaehlsym = 13;
  60.        ibtypedconstsym = 14;
  61.        ibrecorddef = 15;
  62.        ibfiledef = 16;
  63.        ibformaldef = 17;
  64.        ibobjectdef = 18;
  65.        ibenumdef = 19;
  66.        ibsetdef = 20;
  67.        ibprocvardef = 21;
  68.        ibsourcefile = 22;
  69.        ibdbxcount = 23;
  70.        ibfloatdef = 24;
  71.        ibref = 25;
  72.        ibextsymref = 26;
  73.        ibextdefref = 27;
  74.        ibabsolutesym = 28;
  75.        ibclassrefdef = 29;
  76.        ibpropertysym = 30;
  77.        iblibraries = 31;
  78.        iblongstringdef = 32;
  79.        ibansistringdef = 33;
  80.        ibunitname      = 34;
  81.        ibwidestringdef = 35;
  82.        ibstaticlibs    = 36;
  83.        ibend = 255;
  84.  
  85.        { unit flags }
  86.        uf_init = 1;
  87.        uf_uses_dbx = 2;
  88.        uf_uses_browser = 4;
  89.        uf_in_library = 8;
  90.        uf_shared_library = 16;
  91.        uf_big_endian = 32;
  92. Type
  93.  
  94.   absolutetyp = (tovar,toasm,toaddr);
  95.  
  96.        tbasetype = (uauto,uvoid,uchar,
  97.                     u8bit,u16bit,u32bit,
  98.                     s8bit,s16bit,s32bit,
  99.                     bool8bit,bool16bit,bool32bit);
  100.  
  101.        { don't change the order of these - used to determine processor }
  102.        { taken from FPC v0.99.5 systems.pas                            }
  103.        ttarget = (target_GO32V1,target_OS2,target_LINUX,
  104.                   target_WIN32,target_GO32V2,
  105.                   target_Amiga,target_Atari,target_Mac68k);
  106.  
  107.  
  108. var abstyp : absolutetyp;
  109.     utarget : ttarget;
  110.  
  111.     function upper(const s : string) : string;
  112.       var
  113.          i  : longint;
  114.       begin
  115.          for i:=1 to length(s) do
  116.           if s[i] in ['a'..'z'] then
  117.            upper[i]:=char(byte(s[i])-32)
  118.           else
  119.            upper[i]:=s[i];
  120.          upper[0]:=s[0];
  121.       end;
  122.  
  123.   function readlong : longint;
  124.  
  125.     var
  126.        l : longint;
  127.        w1, w2: word;
  128.  
  129.     begin
  130.        blockread(f,l,4);
  131. {$ifdef BIG_ENDIAN}
  132.          w1:=l and $ffff;
  133.          w2:=l shr 16;
  134.          l:=swap(w2)+(longint(swap(w1)) shl 16);
  135. {$endif}
  136.        readlong:=l;
  137.     end;
  138.  
  139.   function readword : word;
  140.  
  141.     var
  142.        w : word;
  143.  
  144.     begin
  145.        blockread(f,w,2);
  146. {$IFDEF BIG_ENDIAN}
  147.        w:=swap(w);
  148. {$ENDIF}
  149.        readword:=w;
  150.     end;
  151.  
  152.   function readdouble : double;
  153.  
  154.     var
  155.        d : double;
  156.  
  157.     begin
  158.        blockread(f,d,8);
  159.        readdouble:=d;
  160.     end;
  161.  
  162.   function readbyte : byte;
  163.  
  164.     var
  165.        b : byte;
  166.  
  167.     begin
  168.        blockread(f,b,1);
  169.        readbyte:=b;
  170.     end;
  171.  
  172.   function readstring : string;
  173.  
  174.     var
  175.        s : string;
  176.  
  177.     begin
  178.        s[0]:=chr(readbyte);
  179.        blockread(f,s[1],ord(s[0]));
  180.        readstring:=s;
  181.     end;
  182.  
  183.   var
  184.      space : string;
  185.      read_member : boolean;
  186.  
  187.   procedure readandwriteref;
  188.  
  189.     var
  190.        w : word;
  191.  
  192.     begin
  193.        w:=readword;
  194.        if w=$ffff then
  195.          begin
  196.             w:=readword;
  197.             if w=$ffff then
  198.               writeln('nil')
  199.             else writeln('Local Definition Nr. ',w)
  200.          end
  201.        else writeln('Unit ',w,'  Nr. ',readword)
  202.     end;
  203.  
  204.   { reads the flags of a definition }
  205.   procedure readflags;
  206.  
  207.     begin
  208.        if version<13 then
  209.          readword;
  210.     end;
  211.  
  212.   var
  213.      b : byte;
  214.      unitnumber : word;
  215.  
  216.   type
  217.      tsettyp = (normset);
  218.  
  219.   procedure readin;
  220.  
  221.     var
  222.        oldread_member : boolean;
  223.        counter : word;
  224.        sourcename : string;
  225.  
  226.  
  227.     procedure read_abstract_proc_def;
  228.  
  229.        var
  230.           params : word;
  231.           options : longint;
  232.  
  233.        begin
  234.           write(space,'      Return type : ');
  235.           readandwriteref;
  236.           if Version<13 then
  237.             options:=readword
  238.           else
  239.             options:=readlong;
  240.           if options<>0 then
  241.             begin
  242.                write(space,'          Options : ');
  243.                if (options and 1)<>0 then
  244.                write('Exception handler ');
  245.                if (options and 2)<>0 then
  246.                  write('Virtual Method ');
  247.                if (options and 4)<>0 then
  248.                  write('Stack is not cleared, ');
  249.                if (options and 8)<>0 then
  250.                  write('Constructor ');
  251.                if (options and $10)<>0 then
  252.                  write('Destructor ');
  253.                if (options and $20)<>0 then
  254.                  write('Internal Procedure ');
  255.                if (options and $40)<>0 then
  256.                  write('Exported Procedure ');
  257.                if (options and $80)<>0 then
  258.                  write('I/O-Checking');
  259.                if (options and $100)<>0 then
  260.                  write('Abstract method');
  261.                if (options and $200)<>0 then
  262.                  write('Interrupt Handler');
  263.                if (options and $400)<>0 then
  264.                  write('Inline Procedure');
  265.                if (options and $800)<>0 then
  266.                  write('Assembler Procedure');
  267.                if (options and $1000)<>0 then
  268.                  write('Overloaded Operator');
  269.                if (options and $2000)<>0 then
  270.                  write('External Procedure');
  271.                if (options and $4000)<>0 then
  272.                  write('Expects parameters from left to right');
  273.                if (options and $8000)<>0 then
  274.                  write('Main Program');
  275.                if (options and $10000)<>0 then
  276.                  write('Static Method');
  277.                if (options and $20000)<>0 then
  278.                  write('Method with Override Direktive');
  279.                if (options and $40000)<>0 then
  280.                  write('Class Method');
  281.                if (options and $80000)<>0 then
  282.                  write('Unit Initialisation');
  283.                if (options and $100000)<>0 then
  284.                  write('Method Pointer (must be a procedure variable)');
  285.                writeln
  286.             end;
  287.           params:=readword;
  288.           writeln(space,'  Nr of parameters: ',params);
  289.           if params>0 then
  290.             writeln(space,'   Parameter defs : ');
  291.           while params>0 do
  292.             begin
  293.                write(space,'    Type: ',readbyte,'  ');
  294.                readandwriteref;
  295.                dec(params);
  296.             end;
  297.        end;
  298.  
  299.      var
  300.         params : word;
  301.        IgnoreEnd : Longint;
  302.  
  303.  
  304.     begin
  305.  
  306.  
  307.        counter:=0;
  308.        IgnoreEnd:=0;
  309.        repeat
  310.          b:=readbyte;
  311.  
  312.          if not (b in [ibend,ibloadunit,ibinitunit,iblinkofile,ibsourcefile,
  313.                        iblibraries,ibunitname,ibstaticlibs]) then
  314.            begin
  315.               write(space,'Definition Nr. ',counter,' : ');
  316.               inc(counter);
  317.            end;
  318.          case b of
  319.             ibloadunit : begin
  320.                             writeln('Uses unit (interface): ',readstring,' (',unitnumber,
  321.                               ')  (Checksum: ',readlong,')');
  322.                             inc(unitnumber);
  323.                             { version 12 writes a ibend after this.}
  324.                             if version>=12 then inc(ignoreend);
  325.                          end;
  326.             ibunitname : Writeln ('Unit name : ',readstring);
  327.             ibsourcefile : begin
  328.                            { Only version 12 and higher do this }
  329.                            SourceName:=ReadString;
  330.                            writeln ('Unit source file : ', SourceName);
  331.                            { stupid situation :
  332.  
  333.                              }
  334.                            if Upper(SourceNAme)='SYSTEM.INC' then
  335.                              {Systemunit:=true;}
  336.                              Inc(IgnoreEnd);
  337.                            if IgnoreEnd<1 then Inc(IgnoreEnd);
  338.                            end;
  339.             iblibraries : Writeln ('Link with library : ', readstring);
  340.             ibstaticlibs : Writeln ('Link static with library : ',readstring);
  341.             ibpointerdef : begin
  342.                               readflags;
  343.                               write(space,'Pointerdefinition to : ');
  344.                               readandwriteref;
  345.                            end;
  346.  
  347.              iborddef : begin
  348.                             readflags;
  349.                             write(space,'Base type ');
  350.                             case tbasetype(readbyte) of
  351.                              uauto : writeln('uauto');
  352.                              uvoid : writeln('uvoid');
  353.                              uchar : writeln('uchar');
  354.                              u8bit : writeln('u8bit');
  355.                             u16bit : writeln('u16bit');
  356.                             u32bit : writeln('s32bit');
  357.                              s8bit : writeln('s8bit');
  358.                             s16bit : writeln('s16bit');
  359.                             s32bit : writeln('s32bit');
  360.                           bool8bit : writeln('bool8bit');
  361.                          bool16bit : writeln('bool16bit');
  362.                          bool32bit : writeln('bool32bit');
  363.                             end;
  364.                             writeln(space,'  Range: ',readlong,' to ',readlong);
  365.                          end;
  366.             ibfloatdef : begin
  367.                            readflags;
  368.                            writeln (space,'Float definition');
  369.                            writeln (space, '  Float type : ',readbyte);
  370.                          end;
  371.  
  372.             ibarraydef : begin
  373.                             readflags;
  374.                             writeln(space,'Array definition');
  375.                             write(space,'  Element type: ');
  376.                             readandwriteref;
  377.                             write(space,'  Range Type: ');
  378.                             readandwriteref;
  379.                             writeln(space,'  Range: ',readlong,' to ',readlong);
  380.                          end;
  381.             ibprocdef : begin
  382.                            readflags;
  383.                            writeln(space,'Procedure definition : ');
  384.                            if version<8 then
  385.                              begin
  386.                                 writeln(space,'  Used Register: ',readbyte);
  387.                                 write(space,  '   Return type : ');
  388.                                 readandwriteref;
  389.                                 write(space,'       Options : ',readword);
  390.                                 writeln(space,'  Mangled Name : ',readstring);
  391.                                 writeln(space,'        Number : ',readlong);
  392.                                 write(space,'            Next : ');
  393.                                 readandwriteref;
  394.                                 params:=readword;
  395.                                 writeln(space,'  Nr. of Parameters: ',params);
  396.                                 writeln(space,'  Parameter definitions: ');
  397.                                 while params>0 do
  398.                                   begin
  399.                                      write(space,'    Type: ',readbyte,'  ');
  400.                                      readandwriteref;
  401.                                      dec(params);
  402.                                   end;
  403.                              end
  404.                            else
  405.                              begin
  406.                                 read_abstract_proc_def;
  407.                                 { m68k targets use a word to save registers }
  408.                                 if utarget in [target_AMIGA..target_MAC68k] then
  409.                                    writeln(space,'    Used Register : ',readword)
  410.                                 else
  411.                                    writeln(space,'    Used Register : ',readbyte);
  412.                                 writeln(space,'     Mangled name : ',readstring);
  413.                                 writeln(space,'           Number : ',readlong);
  414.                                 write  (space,'             Next : ');
  415.                                 readandwriteref;
  416.                                 if version>11 then readlong;
  417.                              end;
  418.                         end;
  419.             ibprocvardef : begin
  420.                               readflags;
  421.                               writeln(space,'Procedural type :');
  422.                               read_abstract_proc_def;
  423.                            end;
  424.             ibstringdef:
  425.               begin
  426.                  readflags;
  427.                  writeln(space,'String definition with length: ',readbyte);
  428.               end;
  429.             ibwidestringdef:
  430.               begin
  431.               readflags;
  432.               writeln (space,'WideString definition with length: ',readlong);
  433.               end;
  434.             ibansistringdef:
  435.               begin
  436.               readflags;
  437.               writeln (space,'AnsiString definition with length: ',readlong);
  438.               end;
  439.             iblongstringdef:
  440.               begin
  441.               readflags;
  442.               writeln (space,'Longstring definition with length: ',readlong);
  443.               end;
  444.             ibrecorddef : begin
  445.                              readflags;
  446.                              writeln(space,'Record definition with size ',readlong);
  447.                              oldread_member:=read_member;
  448.                              read_member:=true;
  449.                              space:=space+'    ';
  450.                              readin;
  451.                              dec(byte(space[0]),4);
  452.                              read_member:=oldread_member;
  453.                           end;
  454.             ibobjectdef : begin
  455.                             readflags;
  456.                             writeln(space,'Class definition with size ',readlong);
  457.                             writeln(space,'  Name of Class  : ',readstring);
  458.                             write(space,  '  Ancestor Class : ');
  459.                             readandwriteref;
  460.                             if version>12 then
  461.                              writeln (space,  '         Options : ',readlong)
  462.                             else
  463.  
  464.                              writeln (space,  '         Options : ',readword);
  465.                             oldread_member:=read_member;
  466.                             read_member:=true;
  467.                             space:=space+'    ';
  468.                             readin;
  469.                             dec(byte(space[0]),4);
  470.                             read_member:=oldread_member;
  471.                          end;
  472.             ibfiledef : begin
  473.                            readflags;
  474.                            case readbyte of
  475.                               0 : writeln(space,'Text file definition');
  476.                               1 : begin
  477.                                      write(space,'Typed file definition of Type : ');
  478.                                      readandwriteref;
  479.                                   end;
  480.                               2 : writeln(space,'Untyped file definition');
  481.                            end;
  482.                         end;
  483.             ibformaldef:
  484.               begin
  485.                  readflags;
  486.                  writeln(space,'Generic Definition (void-typ)');
  487.               end;
  488.             ibenumdef:
  489.               begin
  490.                  readflags;
  491.                  writeln(space,'Enumeration type definition');
  492.                  writeln(space,'Largest element: ',readlong);
  493.               end;
  494.             ibclassrefdef:
  495.               begin
  496.                  readflags;
  497.                  write(space,'Class reference definition to: ');
  498.                  readandwriteref;
  499.               end;
  500.             ibinitunit : writeln('Needs Initialising: ',readstring);
  501.             iblinkofile : writeln('Link with: ',readstring);
  502.             ibsetdef : begin
  503.                           readflags;
  504.                           writeln(space,'Set definition');
  505.                           write(space,'  Element type: ');
  506.                           readandwriteref;
  507.                           b:=readbyte;
  508.                           case tsettyp(b) of
  509.                              normset : writeln(space,'  Set with 256 Elements');
  510.                              else
  511.                                begin
  512.                                   writeln('Invalid unit format : Invalid set type.');
  513.                                   exit;
  514.                                end;
  515.                           end;
  516.                        end;
  517.             ibref : begin
  518.                     writeln ('Error : Don''t know how to handle IBREF yet.');
  519.                     exit;
  520.                     end;
  521.             ibextsymref : begin
  522.                           writeln ('Error : Don''t know how to handle IBEXTSYMREF yet.');
  523.                           exit;
  524.                           end;
  525.             ibextdefref : begin
  526.                           writeln ('Error : Don''t know how to handle IBEXTDEFREF yet.');
  527.                           exit;
  528.                           end;
  529.             ibend : begin
  530.                     if (version<12) or (ignoreend<=0) then
  531.                        break
  532.                      else
  533.                        dec(ignoreend);
  534.                     end;
  535.             else
  536.               begin
  537.                  writeln('Invalid unit format : Invalid definition type encountered : ',b);
  538.                  exit;
  539.               end;
  540.          end;
  541.        until false;
  542.        repeat
  543.          b:=readbyte;
  544.          case b of
  545.             ibtypesym : begin
  546.                            writeln(space,'Type symbol ',readstring);
  547.                            write(space,'  Definition: ');
  548.                            readandwriteref;
  549.                         end;
  550.             ibprocsym : begin
  551.                            writeln(space,'Procedure symbol ',readstring);
  552.                            write(space,'  Definition: ');
  553.                            readandwriteref;
  554.                         end;
  555.             ibconstsym : begin
  556.                             if version<10 then
  557.                               begin
  558.                                  writeln(space,'Constant symbol ',readstring);
  559.                                  write(space,'  Value: ');
  560.                                  case readbyte of
  561.                                     0 : writeln(readlong);
  562.                                     1 : writeln('"'+readstring+'"');
  563.                                     2 : writeln(''''+chr(readbyte)+'''');
  564.                                     3 : writeln(readdouble);
  565.                                     4 : if readbyte=0 then writeln('FALSE')
  566.                                       else writeln('TRUE');
  567.                                  end;
  568.                               end
  569.                             else if version<12 then
  570.                               begin
  571.                                  writeln(space,'Constant symbol ',readstring);
  572.                                  write(space,'  Definition: ');
  573.                                  b:=readbyte;
  574.                                  readandwriteref;
  575.                                  write(space,'  Value: ');
  576.                                  case b of
  577.                                     0 : writeln(readlong);
  578.                                     1 : writeln('"'+readstring+'"');
  579.                                     2 : writeln(readdouble);
  580.                                  end;
  581.                               end
  582.                             else
  583.  
  584.                               begin
  585.                                  writeln(space,'Constant symbol ',readstring);
  586.                                  b:=readbyte;
  587.                                  if b<>0 then
  588.                                    write(space,'  Value: ');
  589.                                  case b of
  590.                                     0 : begin
  591.                                         write (space,'  Definition : ');
  592.                                         readandwriteref;
  593.                                         writeln (space,'  Value : ',readlong)
  594.                                         end;
  595.                                     3 : if readlong<>0 then
  596.  
  597.                                           writeln ('True')
  598.  
  599.                                         else
  600.  
  601.                                           writeln ('False');
  602.                                     4,5 : writeln(readlong);
  603.  
  604.                                     1 : writeln('"'+readstring+'"');
  605.                                     2 : writeln(readdouble);
  606.                                  end;
  607.                               end;
  608.                          end;
  609.             ibvarsym : begin
  610.                            write(space,'Variable symbol ',readstring);
  611.                            write(' (Type: ',readbyte);
  612.                            if read_member then
  613.                              write(', Address: ',readlong);
  614.                            writeln (')');
  615.                            write(space,'  Definition: ');
  616.                            readandwriteref;
  617.                         end;
  618.             ibaufzaehlsym : begin
  619.                                writeln(space,'Enumeration symbol ',readstring);
  620.                                write(space,'  Definition: ');
  621.                                readandwriteref;
  622.                                writeln(space,'  Value: ',readlong);
  623.                             end;
  624.             ibtypedconstsym : begin
  625.                                  writeln(space,'Typed constant ',readstring);
  626.                                  write(space,'  Definition');
  627.                                  readandwriteref;
  628.                                  writeln(space,'  Label: ',readstring);
  629.                               end;
  630.             ibabsolutesym : begin
  631.                               write(space,'Absolute variable symbol ',readstring);
  632.                               write(' (Type: ',readbyte);
  633.                               if read_member then
  634.                                 write(', Address: ',readlong);
  635.                               writeln (')');
  636.                               write(space,'  Definition: ');
  637.                               readandwriteref;
  638.                               abstyp:=absolutetyp(readbyte);
  639.                               Write (space,'  Relocated to ');
  640.                               case abstyp of
  641.                                 tovar  : Writeln ('Name : ',readstring);
  642.                                 toasm  : Writeln ('Assembler name : ',readstring);
  643.                                 toaddr : Writeln ('Address : ',readlong);
  644.                               else
  645.                                 Writeln ('Invalid unit format : Invalid absolute type encountered :',byte(abstyp));
  646.                               end;
  647.  
  648.                             end;
  649.             ibend : break;
  650.             else
  651.                begin
  652.                   writeln('Invalid Unit format : Invalid symbol type encountered :', b);
  653.                   exit;
  654.                end;
  655.          end;
  656.        until false;
  657.        if (version>11) and not read_member then
  658.          begin
  659.          { Check use of dbx }
  660.          if (flags and uf_uses_dbx)<>0 then
  661.            begin
  662.  
  663.            Writeln ('DBXcount : ',readbyte,',',readlong);
  664.            if readbyte<>ibend then Writeln ('Illegal unit file.')
  665.            end;
  666.          { Read implementation units. }
  667.          repeat
  668.            b:=readbyte;
  669.            case b of
  670.  
  671.             ibend : ;
  672.        ibloadunit : begin
  673.                       Write ('Uses unit (implementation) : ',readstring);
  674.                       Writeln (' Checksum : ',readlong);
  675.                     end;
  676.            else
  677.  
  678.             begin
  679.               writeln ('Invalid unit file : No used units part.');
  680.               exit;
  681.             end;
  682.            end;
  683.  
  684.          until b=ibend;
  685.  
  686.          end;
  687.     end;
  688.  
  689.   var
  690.      hs : string;
  691.      w : word;
  692.  
  693.  
  694. procedure dofile (const s : string);
  695.  
  696. begin
  697.   filename:=s;
  698.   assign(f,filename);
  699.   {$i-}
  700.    reset(f,1);
  701.   {$i+}
  702.   if IOResult<>0 then
  703.     begin
  704.     writeln ('IO-Error when opening :',filename,', Skipping.');
  705.     exit
  706.     end
  707.   else
  708.     Writeln ('Reading file : ',filename);
  709.   if (readbyte<>ord('P')) or
  710.      (readbyte<>ord('P')) or
  711.      (readbyte<>ord('U')) then
  712.      begin
  713.         writeln(Filename,' : Not a valid PPU file. Skipping');
  714.      end
  715.    else
  716.      begin
  717.      hs:=chr(readbyte)+chr(readbyte)+chr(readbyte);
  718.      val(hs,version,w);
  719.      writeln('PPU version             : ',version);
  720.      writeln('Compiler version        : ',readbyte,'.',readbyte);
  721.      write  ('Target operating system : ');
  722.      utarget:=ttarget(readbyte);
  723.      case utarget of
  724.         target_GO32V1 : writeln('DOS');
  725.         target_OS2   : writeln('OS/2');
  726.         target_LINUX : writeln('Linux');
  727.         target_WIN32 : writeln('Win32');
  728.         target_AMIGA : writeln('Amiga');
  729.         target_ATARI : writeln('Atari');
  730.         target_Mac68k: writeln('Mac-68k');
  731.      end;
  732.  
  733.  
  734.      flags:=readbyte;
  735.      write ('Unit flags              : ',flags,', ');
  736.      if (flags and uf_init)<>0 then
  737.       write('init ');
  738.      if (flags and uf_uses_dbx)<>0 then
  739.       write('uses_dbx ');
  740.      if (flags and uf_uses_browser)<>0 then
  741.       write('uses_browser ');
  742.      if (flags and uf_in_library)<>0 then
  743.       write('in_library ');
  744.      if (flags and uf_shared_library)<>0 then
  745.       write('shared_library ');
  746.      if (flags and uf_big_endian)<>0 then
  747.       write('big_endian');
  748.      if (flags=0) then
  749.       write('(none)');
  750.  
  751.      writeln;
  752.  
  753.  
  754.      writeln ('Checksum                : ',readlong);
  755.      readword;
  756.      if version>=9 then
  757.      writeln ('Object code start       : ',readlong);
  758.      unitnumber:=1;
  759.      space:='';
  760.      read_member:=false;
  761.      readin;
  762.      end;
  763.    close(f);
  764.    writeln;
  765. end;
  766.  
  767.  
  768.   begin
  769.      writeln('PPU-analyser Version 0.99');
  770.      writeln('Copyright (c) 1995-98 by Florian Klaempfl and Michael Van Canneyt');
  771.      writeln;
  772.      filemode:=0;
  773.      if paramcount<1 then
  774.        begin
  775.           writeln('dumpppu <filename1> <filename2>...');
  776.           halt(1);
  777.        end;
  778.      for nrfile :=1 to paramcount do
  779.        dofile (paramstr(nrfile));
  780.   end.
  781. {
  782.  
  783.   $Log: dumpppu.pp,v $
  784.   Revision 1.7  1998/08/12 12:17:07  carl
  785.     * Make it work with FPC 0.99.5
  786.     + m68k targets support
  787.     + BIG_ENDIAN machine support
  788.  
  789.   Revision 1.5  1998/06/12 14:46:07  peter
  790.     * update tbasetype
  791.  
  792.   Revision 1.4  1998/05/07 08:48:12  michael
  793.   + Some cosmetic changes for smart linking.
  794.  
  795.   Revision 1.3  1998/05/06 11:05:32  michael
  796.   + Updated to ppu version 14. Added strings and unitname handlers
  797.  
  798.   Revision 1.2  1998/04/29 22:41:17  florian
  799.     * better decoding of procedure options
  800.     + support of PPU format 14
  801. }
  802.